-- msg_pet
-- Create by weism
-- 通知玩家获得宠物

return function(lpc)
    local classId = lpc.class_id;
    local data = lpc.data;
    if (ME.user.pets[classId] ~= nil and 1 ~= lpc.reload) then
        cclog("宠物已经存在了");
        return;
    end

    local pet = Pet.new(classId, data);
    ME.user.pets[classId] = pet;

    if ME.isInGame then
        PropM.refresh(pet)
        PropM.refreshEffect(ME.user, "skill");
        PropM.refreshEffect(ME.user, "equip");
    end

    if 1 ~= lpc.reload then
        -- 临时标记获得的冈布奥
        ME.user.dbase:setTemp("gain_pet_id", classId);

        -- 抛出激活宠物事件
        EventMgr.fire(event.GAIN_PET, classId);
    end
end
